package com.ruoyi.project.csc.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.project.csc.domain.WcsCscQuene;
import com.ruoyi.project.csc.service.IWcsCscQueneService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 四向车执行队列Controller
 * 
 * @author ruoyi
 * @date 2025-04-14
 */
@Controller
@RequestMapping("/system/quene")
public class WcsCscQueneController extends BaseController
{
    private String prefix = "system/quene";

    @Autowired
    private IWcsCscQueneService wcsCscQueneService;

    @GetMapping()
    public String quene()
    {
        return prefix + "/quene";
    }

    /**
     * 查询四向车执行队列列表
     */
    @RequiresPermissions("system:quene:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(WcsCscQuene wcsCscQuene)
    {
        startPage();
        List<WcsCscQuene> list = wcsCscQueneService.selectWcsCscQueneList(wcsCscQuene);
        return getDataTable(list);
    }

    /**
     * 导出四向车执行队列列表
     */
    @RequiresPermissions("system:quene:export")
    @Log(title = "四向车执行队列", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(WcsCscQuene wcsCscQuene)
    {
        List<WcsCscQuene> list = wcsCscQueneService.selectWcsCscQueneList(wcsCscQuene);
        ExcelUtil<WcsCscQuene> util = new ExcelUtil<WcsCscQuene>(WcsCscQuene.class);
        return util.exportExcel(list, "四向车执行队列数据");
    }

    /**
     * 新增四向车执行队列
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存四向车执行队列
     */
    @RequiresPermissions("system:quene:add")
    @Log(title = "四向车执行队列", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(WcsCscQuene wcsCscQuene)
    {
        return toAjax(wcsCscQueneService.insertWcsCscQuene(wcsCscQuene));
    }

    /**
     * 修改四向车执行队列
     */
    @RequiresPermissions("system:quene:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        WcsCscQuene wcsCscQuene = wcsCscQueneService.selectWcsCscQueneById(id);
        mmap.put("wcsCscQuene", wcsCscQuene);
        return prefix + "/edit";
    }

    /**
     * 修改保存四向车执行队列
     */
    @RequiresPermissions("system:quene:edit")
    @Log(title = "四向车执行队列", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(WcsCscQuene wcsCscQuene)
    {
        return toAjax(wcsCscQueneService.updateWcsCscQuene(wcsCscQuene));
    }

    /**
     * 删除四向车执行队列
     */
    @RequiresPermissions("system:quene:remove")
    @Log(title = "四向车执行队列", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(wcsCscQueneService.deleteWcsCscQueneByIds(ids));
    }
}
